package com.example.yunJie.digitalSentry.control;

import com.example.yunJie.digitalSentry.entity.DepartmentEntity;
import com.example.yunJie.digitalSentry.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/Department")
public class DepartmentControl {

    @Autowired
    private DepartmentService departmentService;

    @RequestMapping("/add")
    public void insert(DepartmentEntity departmentEntity) {
        departmentService.insert(departmentEntity);
    }

    @RequestMapping("/update")
    public int update(DepartmentEntity departmentEntity) {
        return departmentService.update(departmentEntity);
    }

    @RequestMapping("/deleteById")
    public int deleteById(String id) {
        return departmentService.deleteById(id);
    }

    @RequestMapping("/deleteIdList")
    public int deleteIdList(List<Integer> id) {
        return departmentService.deleteIdList(id);
    }

    @RequestMapping("/findId")
    public DepartmentEntity findId(String id) {
        return departmentService.findId(id);
    }

    @RequestMapping("/findAll")
    public List<DepartmentEntity> findAll(DepartmentEntity departmentEntity) {
        return departmentService.findAll(departmentEntity);
    }
}
